﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ScenarionTests.cs" company="dimamartovoi">
//   Apache License
//   Version 2.0, January 2004
//   http://www.apache.org/licenses
// </copyright>
// <summary>
//   The scenarion tests.
// </summary>
// --------------------------------------------------------------------------------------------------------------------



using System.IO;

using ActorModel.Infrastructure;
using ActorModel.Infrastructure.Configuration.XML;

using Common.Logging;

using NUnit.Framework;

namespace EvolutionScenarionTests
{
    /// <summary>
    /// The scenarion tests.
    /// </summary>
    [TestFixture]
    public class ScenarionTests
    {
        #region Public Methods and Operators

        /// <summary>
        /// The scenarion 1.
        /// </summary>
        [Test]
        public void Scenarion1()
        {
            string codePath = Path.Combine(TestContext.CurrentContext.WorkDirectory, @"EvolutionStateFuncs\life.evol");
            string code = File.ReadAllText(codePath);

            var loader = new XMLEngineLoader();
            EngineStartParameters<string> parameters = loader.Load(code);
            var engineBootstrapper = new EngineBootstrapper<string>(parameters);
            IEngineFlowController<string> flowController = engineBootstrapper.Initialize();

            ILog log = LogManager.GetLogger("output");

            log.Debug(flowController.ToString());

            flowController.Evolute();

            log.Debug(flowController.ToString());

            flowController.Evolute();

            log.Debug(flowController.ToString());

            flowController.Evolute();

            log.Debug(flowController.ToString());
        }

        #endregion
    }
}